package hsintiao.com.xintiaoAPP.util;

import java.util.Map;

public class RedisClient {

    public static AjaxResult add(Map<String,Object> params){
        String key = (String) params.get("key");
        String value = (String) params.get("value");
        Object expireObj = params.get("expire");
        try{
            if (expireObj!=null){
                Integer expire =Integer.valueOf(expireObj.toString());
                RedisUtils.INSTANCE.set(key,value,expire);
                return AjaxResult.me();
            }
            RedisUtils.INSTANCE.set(key,value);
            return AjaxResult.me();
        }catch (Exception e){
            e.printStackTrace();
            return AjaxResult.me().setSuccess(false).setMessage("保存失败！"+e.getMessage());
        }
    }
}
